Summary
This component enable user-defined code to be executed when the component loops through the result from a xml query that is filtered on up to twenty XML fields.
NOTE:
There are some security issues with this component, see the
Remarks section for more information
Category | AS EPT |
Version | 1.1 |
Complies with Xhtml 1.0 / 1.1 rules | Yes |
Supported server programming languages | C# Visual Basic.NET |
Output content type | Unspecified or not applicable |
When to use
This component is typically used in replacement to List pageable filtred documents 2.0, when there is a need for more flexibility and/or better performance. This component gives the developer more control of the code that is executed for each of the returned documents. Script filtered documents require programming knowledge, but offers on the other hand more control and better performance compared to the List pageable filtered documents 2.0 component.
Programming interface
Parameters
- Field parameter settings
- XMLField1
- Field to filter on
- ReturnField1InResult
- Return this field in result
- Data type 1
- The data type for this field. Must be specified for correct sorting or viewing. Warning: you must be sure that all values in this field corresponds to the chosen data type.
- XMLField2
- Optional field to filter on.
- ReturnField2InResult
- Return this field in result
- Data type 2
- The data type for this field. Must be specified for correct sorting or viewing. Warning: you must be sure that all values in this field corresponds to the chosen data type.
- XMLField3
- Optional field to filter on
- ReturnField3InResult
- Return this field in result
- Data type 3
- The data type for this field. Must be specified for correct sorting or viewing. Warning: you must be sure that all values in this field corresponds to the chosen data type.
- XMLField4
- Optional field to filter on
- ReturnField4InResult
- Return this field in result
- Data type 4
- The data type for this field. Must be specified for correct sorting or viewing. Warning: you must be sure that all values in this field corresponds to the chosen data type.
- XMLField5
- Optional field to filter on
- ReturnField5InResult
- Return this field in result
- Data type 5
- The data type for this field. Must be specified for correct sorting or viewing. Warning: you must be sure that all values in this field corresponds to the chosen data type.
- XMLField6
- Optional field to filter on
- ReturnField6InResult
- Return this field in result
- Data type 6
- The data type for this field. Must be specified for correct sorting or viewing. Warning: you must be sure that all values in this field corresponds to the chosen data type.
- XMLField7
- Optional field to filter on
- ReturnField7InResult
- Return this field in result
- Data type 7
- The data type for this field. Must be specified for correct sorting or viewing. Warning: you must be sure that all values in this field corresponds to the chosen data type.
- XMLField8
- Optional field to filter on
- ReturnField8InResult
- Return this field in result
- Data type 8
- The data type for this field. Must be specified for correct sorting or viewing. Warning: you must be sure that all values in this field corresponds to the chosen data type.
- XMLField9
- Optional field to filter on
- ReturnField9InResult
- Return this field in result
- Data type 9
- The data type for this field. Must be specified for correct sorting or viewing. Warning: you must be sure that all values in this field corresponds to the chosen data type.
- XMLField10
- Optional field to filter on
- ReturnField10InResult
- Return this field in result
- Data type 10
- The data type for this field. Must be specified for correct sorting or viewing. Warning: you must be sure that all values in this field corresponds to the chosen data type.
- XMLField11
- Optional field to filter on
- ReturnField11InResult
- Return this field in result
- Data type 11
- The data type for this field. Must be specified for correct sorting or viewing. Warning: you must be sure that all values in this field corresponds to the chosen data type.
- XMLField12
- Optional field to filter on
- ReturnField12InResult
- Return this field in result
- Data type 12
- The data type for this field. Must be specified for correct sorting or viewing. Warning: you must be sure that all values in this field corresponds to the chosen data type.
- XMLField13
- Optional field to filter on
- ReturnField13InResult
- Return this field in result
- Data type 13
- The data type for this field. Must be specified for correct sorting or viewing. Warning: you must be sure that all values in this field corresponds to the chosen data type.
- XMLField14
- Optional field to filter on
- ReturnField14InResult
- Return this field in result
- Data type 14
- The data type for this field. Must be specified for correct sorting or viewing. Warning: you must be sure that all values in this field corresponds to the chosen data type.
- XMLField15
- Optional field to filter on
- ReturnField15InResult
- Return this field in result
- Data type 15
- The data type for this field. Must be specified for correct sorting or viewing. Warning: you must be sure that all values in this field corresponds to the chosen data type.
- XMLField16
- Optional field to filter on
- ReturnField16InResult
- Return this field in result
- Data type 16
- The data type for this field. Must be specified for correct sorting or viewing. Warning: you must be sure that all values in this field corresponds to the chosen data type.
- XMLField17
- Optional field to filter on
- ReturnField17InResult
- Return this field in result
- Data type 17
- The data type for this field. Must be specified for correct sorting or viewing. Warning: you must be sure that all values in this field corresponds to the chosen data type.
- XMLField18
- Optional field to filter on
- ReturnField18InResult
- Return this field in result
- Data type 18
- The data type for this field. Must be specified for correct sorting or viewing. Warning: you must be sure that all values in this field corresponds to the chosen data type.
- XMLField19
- The tenth field you want to use either in result criteria or sort.
- ReturnField19InResult
- Return this field in result
- Data type 19
- The data type for this field. Must be specified for correct sorting or viewing. Warning: you must be sure that all values in this field corresponds to the chosen data type.
- XMLField20
- Optional field to filter on
- ReturnField20InResult
- Return this field in result
- Data type 20
- The data type for this field. Must be specified for correct sorting or viewing. Warning: you must be sure that all values in this field corresponds to the chosen data type.
- FilterCriteria
- Optional filter criteria.
- This filter criteria is the WHERE part of a regular
SQL query. You can use any of the fields you have specfied above but their names
must be enclosed with []. Since the underlying data is stored in Xml all field names
are case sensitive.
For example:
[Country] = 'Sweden'
([Age] > '18' AND [Sex] = 'F') OR ([Age] > '20' AND [Sex] = 'M')
- Dynamic code to run
- Pre code
- Optional, a value that specifies ASP.NET code to run before the loop.
- LoopScript
- A value that specifies ASP.NET code that will excute for each row data row returned.
- The
data of the current row is stored in a dictionary called EPTData. The dictionary
contains keys with the same name as you specified in the XMLField:s and are returned.
Example:
If you specified Gender and Name in one of the XMLField:s you can type:if (EPTData["Gender"].ToUpper() == "M") Page.Response.Write(Page.Server.HTMLEncode(EPTData["Name"]) + " is a male."; else Page.Response.Write(Page.Server.HTMLEncode(EPTData["Name"]) + " is a female.";
If EPTData("Gender").ToUpper() = "M" Then Page.Response.Write(Page.Server.HTMLEncode(EPTData("Name")) & " is a male." Else Page.Response.Write(Page.Server.HTMLEncode(EPTData("Name")) & " is a female." End If
There is one global member named documentid which contains the document id for the current row. This data can be retrieved with by typing:
EPTData("documentid")
EPTData["documentid"];
If you want to use a lookup category you can call the
CSF_LookUpField method.To access the page on which the component is included in, you must use the Page property. Ex: Page.Response.Write("").
In addition to all above, there is also an object called EPTProperties wich contains the properties RecordCount and PageCount.
If the page, where the component is included, is written in C#, the ScriptForRowX must also use C#. Hence, if the page is written in VB, the ScriptForRowX must also use VB.
- AftScript
- Optional, a value that specifies ASP.NET code to run after the loop
- Text labels and presentation>
- RecordTextTop
- This text is displayed at the top, but only when one or more records was returned. Available constants that can be used in the text is $RecordCount$ and $PageCount$.
- RecordTextBottom
- This text is displayed at the bottom, but only when one or more records was returned. Available constants that can be used in the text is $RecordCount$ and $PageCount$.
- NoRecordText
- A Text that will be displayed when no records is returned.
- NoRecordDocId
- An id for a document that will be inserted when no records is returned.
- NoRecordDocPTId
- A presentation template id to use for NoRecordDocId.
- Sorting settings
- SortField
- Optional field to sort on
- SecondarySortField
- Optional secondary field to sort on
- SortDesc
- Sort descending
- SecondarySortDesc
- Sort descending for secondary field
- RandomSort
- Randomize Sort Order
- Pageing settings
- UsePageing
- Specifies whether to use paging or not.
- Pageing options
-
One of the following options:
- Top
Use pageing on top. - Bottom
Use pageing on bottom. - Both
Use pageing on bottom and top.
- Top
- PageSize
- Max number of documents to list on each page. A PageSize of 0 will show all available records. If UsePaging is not checked, the number of records shown will be limited by the value of this parameter.
- PageNo
- The page number you want to retrieve. This parameter will be ignored if UsePaging is checked
- RangeSize
-
This parameter controls the number of paging-links that will be displayed for each
range.
For example, a rangesize of 3 will initially display the links:
1 2 3 > >>
- UniqueID
- Change this parameter if you want to use paging on more than one component at this page.
- TextBeforeRange
- Optional. The text or HTML to display before the paging section starts.
- TextAfterRange
- Optional. The text or HTML to display after the paging section ends.
- LinkAttributes
- Attributes for paging links.
- Handle posted pages
- Leading page range text
- The text to display before the paging-links.
- Link separator text
- Separator between links
- Link prefix text
- The text to display at the beginning of each link.
- Previous page range text
- The text to display in the link to the previous range.
- Previous page text
- The text to display in the link to the previous page.
- Next page text
- The text to display in the link to the next page.
- Next page range text
- The text to display in the link to the next range.
- Ignore publishstatus and list drafts
-
- List approved documents
If set, only browse permission is required. - List drafts
If set, only drafts is listed. This option require read permission. - List drafts or approved documents
If set, The result will contain drafts or approved documents if no draft was found. Read permission is required.
- List approved documents
- Ignore publish status
- Ignores Publishdate, Archivedate and withdrawn status. Can be usefull to list documents for editing. If this option is set then read permissions is required, not only browse.
- Check for read permission
- Check this if you want the component to check for read permission instead of browse permission.
- Aggregate values
- Return type
-
Group and count will return distinct values from all fields chosen and a parameter
named aggregatevalue that contains the count for distinct values.
Select distinct values will return the same as above except aggregatevalue.
The other three options requires that the value in field one will only contains integer values for all returned documents. Only the field aggregatevalue will be returned for the first field. DocumentId will return 0 for all options and pagesize will be ignored. As default, sorting is done on the aggregatevalue ASC, but sorting can be changed. - Cache methods
-
- No cache
Do not cache the xml query. - Use application cache
Cache the result from the xml query using application variables.
WARNING there are security problems with this parameter. See the Remarks section for more information.
- No cache
- Application cache timeout
- Timeout in minutes for application cache, 0 = no timeout
- Run in PreInit
- The execution of the script in the PreInit event of the current document. This feature will enable adding and updating server controls.
Remarks
If the page, where the component is included, is written in C#, the parameters PreCode, ScriptForRowX and AfterScript in this component must also use C#. Hence, if the page is written in VB, the parameters must use VB.
Security Warning
If the component cache method is set to Use application cache, and the xml query items contain security permissions which might differ among visitors, a potential security problem exists. If a user that has high level access visits the page where this component resides and the result is cached, a user with restricted access that visits the page at a later time might be able to get hold of information which should be inaccessible to him/her.
This component bypasses the built in restriction policy that prevents trusted users
from writing code that can execute on the server side. For this reason you should
not make this component available to user that do not have the right to write programming
code (see the
Never include this component in a document that is ment to be edited by regular users - this will force you to give them access to this component. To protect this component from illegitimate use, restrict permission on the component itself to developers only.